#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
	int mySqrt(int x) {
		if(x<1) return 0;
		long long l=1,r=x;
		while(l<r)
		{
			long long mid=l+(r-l+1)/2;
			if(mid*mid<=x) l=mid;
			else r=mid-1;
		}
		return l;
	}
};
